<?php
use yii\helpers\Html;
use yii\grid\GridView;
use common\widgets\Helper;
use yii\grid\ActionColumn;
?>

<div class="ibox-title">
	<h5>文章列表</h5>
</div>
<div class="ibox-content timeline">
	<div class="box-create">
		<?= Html::a('添加文章', ['add'], ['class' => 'btn btn-primary langse'])?>
	</div>
    <?=
       GridView::widget([
           'dataProvider' => $dataProvider,
           'filterModel' => $searchModel,
           'columns' => [
               ['class' => 'yii\grid\SerialColumn'],
              [
                   'attribute' => 'cate_title',
                   'value' => 'category.title'
               ],

               'title',
               [
                   'attribute' => 'image',
                   'format' => 'raw',
                   'value' => function($model){
                       return Html::img($model->image,['class' => 'list_img', 'width' => 100]);
                   }
               ],
               'excerpt',
               'digest',
               'display',
               [
                   'attribute' => 'create_time',
                   'format' => ['date', 'php:Y-m-d']
               ],
               /*[
                   'attribute' => 'status',
                   'value' => function($model) {
                       return $model->status == 0 ? 'Inactive' : 'Active';
                   },
                   'filter' => [
                       0 => 'Inactive',
                       10 => 'Active'
                   ]
               ],*/
               [
                   'class' => 'yii\grid\ActionColumn',
                  /* 'template' => Helper::filterActionColumn(['view', 'activate', 'delete']),*/
                   /*'buttons' => [
                       'activate' => function($url, $model) {
                           if ($model->status == 10) {
                               return '';
                           }
                           $options = [
                               'title' => Yii::t('rbac-admin', 'Activate'),
                               'aria-label' => Yii::t('rbac-admin', 'Activate'),
                               'data-confirm' => Yii::t('rbac-admin', 'Are you sure you want to activate this user?'),
                               'data-method' => 'post',
                               'data-pjax' => '0',
                           ];
                           return Html::a('<span class="glyphicon glyphicon-ok"></span>', $url, $options);
                       }
                       ]*/
                   ],
               ],
           ]);
    ?>
</div>

